package redis

import (
	"3-6zk/service/config"
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
)

var Rdb *redis.Client

func ExampleClient() {
	nac := config.Conf.Redis
	Rdb = redis.NewClient(&redis.Options{
		Addr:     nac.Host,
		Password: nac.Password, // no password set
	})
	ctx := context.Background()
	_, err := Rdb.Ping(ctx).Result()
	if err != nil {
		fmt.Println("redis连接失败")
	} else {
		fmt.Println("redis连接成功")
	}
}
